////////////////////////////////////////////////////////////////////
//RRW RANK AUS PHL- "Combatant Rank and Socialization to Norms of Restraint"
// (International Interactions Replication)

* this version: 2021.01.04

clear all //clear all previous data
cap log close //close all open logs
set more 1 //prevent clicks needed for Stata to run at bottom of page
version 12.0 /* ==> this insures that commands can be used as in Stata 12 */


ssc install tabout ///
ssc install ttab ///
ssc install estout, replace


******************************************
*     Replication Code: Manuscript     	 *
******************************************

********************************
**   Australian Army Data

// Open AUS Army dataset: 
use " C:\Rank and NoR- AUS 2 Ranks Data (II Replication).dta"

// Uses the following variables only: 
	// lethalnecessary lethalsavesoldier riskunitlimitcd rank rank_cat rank_cat_OR rank_cat_OR2 /// 
	// senoff_binary parentscollegebinary malebinary combatbinary infl_pltmembers infl_pltsgt infl_btncdr infl_secldr


// Table 1. Enlisted Rating of Influence Factors (Philippine Army) [See Philippine Army analysis below]
		// Jr Enlisted/Other Ranks Rating of Influence Factors (page 23, manucript) 

// Table 2. Junior Other Ranks Rating of Influence Factors (Australian Army) (page 23, manucript) 
ttest infl_secldr=infl_btncdr if senoff_binary==0 // senoff_binary==0 = Jr. Enlisted/JNCO

ttest infl_pltmembers=infl_btncdr if senoff_binary==0 // senoff_binary==0 = Jr. Enlisted/JNCO


******************************************
*     Replication Code: Appendix     	 *
******************************************


// Table 3. Participants by Rank Category: Australian Army 
tab rank_cat_OR // 2 = Senior Officers, 7 = JNCO + Jr. Enlisted


// Table 4. Demographic Descriptive Statistics:  Australian Army 
estpost summarize senoff_binary parentscollegebinary malebinary combatbinary infl_pltmembers
esttab using example1.tex, label replace booktabs wide ///
	cells("count mean(fmt(2)) sd (fmt (2)) min max") ///
	title (Demographic Descriptive Statistics: Australian Army) ///
	nonumbers mtitles ("Count" "Mean" "SD" "Min" "Max") ///
	addnote ("Source: Australia Army Survey Data")
	

// Table 5. Dependent Variable Descriptive Statistics:  Australian Army
estpost summarize lethalnecessary lethalsavesoldier riskunitlimitcd infl_btncdr infl_secldr infl_pltmembers
esttab using example1.tex, label replace booktabs wide ///
	cells("count mean(fmt(2)) sd (fmt (2)) min max") ///
	title (Demographic Descriptive Statistics: Australian Army) ///
	nonumbers mtitles ("Count" "Mean" "SD" "Min" "Max") ///
	addnote ("Source: Australia Army Survey Data")

	
// (Jump to Table 9): Table 9. Combatant Trilemma, Australia Army: Difference of Means t-tests (for DVs)
eststo clear 

estpost ttest lethalnecessary lethalsavesoldier riskunitlimitcd if senoff_binary==0 | senoff_binary==1, by(senoff_binary) welch
esttab using example1.tex, label replace booktabs wide ///
	cells("b(fmt(2) star) mu_1(fmt(2)) mu_2(fmt(2)) se (fmt (2))  t(par fmt(2)) p(fmt (3)) df_t(fmt(0))") ///
	title (Difference of Means, Combatant Trilemma (Australian Army)) ///
	nonumbers mtitles ("Diff" "Fresh" "Sen" "SE" "t stat" "p") ///
	addnote ("Source: Australian Army Survey Data")	

	
// Table 10: Combatant's Trilemma, Australian Army: Ordered Logit Regressions
eststo clear

eststo model1: ologit lethalnecessary senoff_binary parentscollegebinary malebinary combatbinary infl_pltmembers
eststo model2: ologit lethalsavesoldier senoff_binary parentscollegebinary malebinary combatbinary infl_pltmembers
eststo model3: ologit riskunitlimitcd senoff_binary parentscollegebinary malebinary combatbinary infl_pltmembers

//Publication code
esttab using example1.tex, replace b(3) se(3) scalar(chi2) aic star(* 0.10 ** 0.05 *** 0.01) ///
nonumbers mtitles("Mission" "Save Soldier" "Risk Unit Limit CD") ///
nogaps title(Ordered Logit Regressions: Australian Army)  ///
 addnote("Source: Australian Army Survey Data")
	

	
********************************
**   Philippine Army Dataset

clear 

// Load Philippine Army dataset	
use "C:\Rank and NoR- PHL 2 Ranks Data (II Replication).dta" 
// Uses the following variables only: 
	// killnecessary killsavesoldier riskunitlimitcd rank_cat /// 
	// senoff_binary parentscollegebinary malebinary combatbinary infl_pltmembers infl_pltsgt infl_btncdr


***** Jr Enlisted/Other Ranks Rating of Influence Factors (page 23, manucript) *****

// Table 1. Enlisted Rating of Influence Factors (Philippine Army)
ttest infl_pltsgt=infl_btncdr if senoff_binary==0 // senoff_binary==0 = Jr. Enlisted/JNCO

ttest infl_pltmembers=infl_btncdr if senoff_binary==0 // senoff_binary==0 = Jr. Enlisted/JNCO


// Table 6. Participants by Rank Category: Philippine Army
tab rank_cat


// Table 7. Demographic Descriptive Statistics:  Philippine Army
eststo clear
estpost summarize senoff_binary parentscollegebinary malebinary combatbinary infl_pltmembers
esttab using example1.tex, label replace booktabs wide ///
	cells("count mean(fmt(2)) sd (fmt (2)) min max") ///
	title (Demographic Descriptive Statistics: Philippine Army) ///
	nonumbers mtitles ("Count" "Mean" "SD" "Min" "Max") ///
	addnote ("Source: Philippine Army Survey Data")

	
// Table 8. Dependent Variable Descriptive Statistics:  Philippine Army
eststo clear
estpost summarize killnecessary killsavesoldier riskunitlimitcd infl_btncdr infl_pltsgt infl_pltmembers
esttab using example1.tex, label replace booktabs wide ///
	cells("count mean(fmt(2)) sd (fmt (2)) min max") ///
	title (Demographic Descriptive Statistics: Philippine Army) ///
	nonumbers mtitles ("Count" "Mean" "SD" "Min" "Max") ///
	addnote ("Source: Philippine Army Survey Data")


//  (Jump to Table 11) Table 11. Combatant Trilemma, Philippine Army: Difference of Means t-tests (for DVs)
eststo clear
estpost ttest killnecessary killsavesoldier riskunitlimitcd if senoff_binary==0 | senoff_binary==1, by(senoff_binary) welch
esttab using example1.tex, label replace booktabs wide ///
	cells("b(fmt(2) star) mu_1(fmt(2)) mu_2(fmt(2)) se (fmt (2))  t(par fmt(2)) p(fmt (3)) df_t(fmt(0))") ///
	title (Difference of Means, Combatant Trilemma (Philippine Army)) ///
	nonumbers mtitles ("Diff" "Fresh" "Sen" "SE" "t stat" "p") ///
	addnote ("Source: Philippine Army Survey Data")	


// Table 12: Combatant's Trilemma, Australian Army: Ordered Logit Regressions
eststo clear

eststo model1: ologit killnecessary senoff_binary parentscollegebinary malebinary combatbinary infl_pltmembers
eststo model2: ologit killnecessary senoff_binary parentscollegebinary malebinary combatbinary infl_pltmembers
eststo model3: ologit riskunitlimitcd senoff_binary parentscollegebinary malebinary combatbinary infl_pltmembers

//Publication code
esttab using example1.tex, replace b(3) se(3) scalar(chi2) aic star(* 0.10 ** 0.05 *** 0.01) ///
nonumbers mtitles("Mission" "Save Soldier" "Risk Unit Limit CD") ///
nogaps title(Ordered Logit Regressions: Philippine Army)  ///
 addnote("Source: Philippine Army Survey Data")
	
	
// END OF CODE
	
	
	
	